"use strict";
cc._RF.push(module, 'c8ee1fJB9JNzLz2wI3tzIil', 'ShowItem');
// scripts/ShowItem.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("CarConstant"),
    s = cc._decorator,
    l = s.ccclass,
    c = s.property,
    d = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.frame_body = null, e.frame_wheel = null, e.frame_weapon = null, e.frame_tools = null, e.arrNode_body = new Array(), e.arrNode_wheel = new Array(), e.arrNode_weapon = new Array(), e.arrNode_tools = new Array(), e.frame_star = null, e.arrNode_star = new Array(5), e._itemType = null, e;
  }

  return n(e, t), e.prototype.initView = function () {
    this.frame_body.active = !1, this.frame_wheel.active = !1, this.frame_weapon.active = !1, this.frame_tools.active = !1, this.frame_star.active = !1;
  }, e.prototype.updateView = function (t) {
    switch (cc.log("展示"), this.initView(), this.showStar(t.star), this._itemType = t.type, cc.log(this._itemType), t.type) {
      case r.Basics_Items_Type.body:
        var e = r.getBodyData(t.id).index;
        this.frame_body.active = !0;

        for (var o = 0; o < this.arrNode_body.length; o++) {
          o == e ? (this.arrNode_body[o].scale, this.arrNode_body[o].active = !0) : this.arrNode_body[o].active = !1;
        }

        break;

      case r.Basics_Items_Type.wheel:
        var i = r.getWheelData(t.id).index;

        for (this.frame_wheel.active = !0, o = 0; o < this.arrNode_wheel.length; o++) {
          this.arrNode_wheel[o].active = o == i;
        }

        break;

      case r.Basics_Items_Type.weapon:
        var n = r.getWeaponData(t.id).index;

        for (this.frame_weapon.active = !0, o = 0; o < this.arrNode_weapon.length; o++) {
          this.arrNode_weapon[o].active = o == n;
        }

        break;

      case r.Basics_Items_Type.tools:
        var a = r.getToolsData(t.id).index;

        for (this.frame_tools.active = !0, o = 0; o < this.arrNode_tools.length; o++) {
          this.arrNode_tools[o].active = o == a;
        }

    }
  }, e.prototype.showStar = function (t) {
    if (t) {
      this.frame_star.active = !0;

      for (var e = 0; e < this.arrNode_star.length; e++) {
        this.arrNode_star[e].active = e < t;
      }
    } else this.frame_star.active = !1;
  }, a([c(cc.Node)], e.prototype, "frame_body", void 0), a([c(cc.Node)], e.prototype, "frame_wheel", void 0), a([c(cc.Node)], e.prototype, "frame_weapon", void 0), a([c(cc.Node)], e.prototype, "frame_tools", void 0), a([c(cc.Node)], e.prototype, "arrNode_body", void 0), a([c(cc.Node)], e.prototype, "arrNode_wheel", void 0), a([c(cc.Node)], e.prototype, "arrNode_weapon", void 0), a([c(cc.Node)], e.prototype, "arrNode_tools", void 0), a([c(cc.Node)], e.prototype, "frame_star", void 0), a([c(cc.Node)], e.prototype, "arrNode_star", void 0), a([l], e);
}(cc.Component);

o["default"] = d;

cc._RF.pop();